#if MSC_VER >=1000
    #pragma execution_character_set("UTF-8")
#endif

#include "downloadls.h"

#include<QProcess>
#include<QStringList>
#include<QDebug>

DownloadLS::DownloadLS()
{
    this->name ="-file=woxiangqianzhenideshou";
    this->url = "-url=http://music.163.com/song/media/outer/url?id=167903.mp3";
    this->path ="-path=/home/mint/temp/music";
}


// 启动下载程序。。。
void DownloadLS::run()
{
    QProcess process(this);

    QStringList arguments;
    arguments<<name<<url<<path;
    process.start("/home/mint/qt/cmd_test/downlaod_east",arguments);
    process.waitForFinished();
    QString result = QString::fromLocal8Bit(process.readAllStandardOutput());
    qDebug()<<"result = "<<result;

    // 发送调用结束的信息
   // emit execFinshed(result);
}


// 设置下载的必须参数
void DownloadLS::setPath(QString path)
{
    this->path = "-path="+path;
}

void DownloadLS::setUrl(QString url)
{
    this ->url = "-url="+url;
}

void DownloadLS::setName(QString name)
{
    this-> name = "-file="+name;
}
